/* Copyright 2009 Sony Mathew, Minneapolis MN. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */
package com.xsm.servlet;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

/**
 * Provides a Binding to a Servlet.
 * 
 * A ServletBindingProvider's class name should be provided to a Servlet as an init parameter. 
 *  (using the key specified as a constant here).
 *  
 * A Servlet should be able to constuct the configured ServletBindingProvider-impl using its default constructor using reflection.
 * The Binding provided by the ServletBindingProvider should be cast(able) to the Context that the Servlet expects.
 * 
 * Important:
 * The ServletBindingProvider instance maybe shared by many servlets or many instances of one servlet.  Make sure to have
 *  no stateful behaviour in any implementation of this interface.
 *  
 * @author Sony Mathew
 */
public interface ServletBindingProvider {

    public static final String PARAM_KEY = "servlet.binding.provider";
            
    /**
     * Provide the binding for the specified servlet and request.
     * 
     * author Sony Mathew
     */
    public Object getServletBinding(HttpServlet servlet, HttpServletRequest req);
}
